<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script src='node_modules/vue/dist/vue.js'></script>
    <script src='./vue-lazyload.js'></script>
    <script src='node_modules/axios/dist/axios.js'></script>
    <!-- 图片懒加载 -->
    动态加载图片：
    <div id="app">
        <div class='box'>
            <li v-for='img in imgs' :key='img'>
                <img v-lazy="img" alt="">
            </li>
        </div>
    </div>
    <script>
        const loading = 'http://localhost:3000/images/1.gif';
        Vue.use(VueLazyload,{
            preload:1.3,
            loading
        })
        let vm = new Vue({
            el: '#app',
            data: {
                imgs:[]
            },
            created(){
                axios.get('http://localhost:3000/api/img').then(res=>{
                    console.log(res);
                    this.imgs = res.data;
                })
            }
        })
    </script>
    <style>
        .box{
            width: 100%;
            height: 300px;
            overflow:scroll;
        }
        img {
            width:100px;
            height: 100px;
        }
    </style>
</body>
</html>
